package com.movie.modules.jf.service.impl;

import com.movie.common.utils.NumberUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.movie.common.utils.PageUtils;
import com.movie.common.utils.Query;

import com.movie.modules.jf.dao.MovieCommentDao;
import com.movie.modules.jf.entity.MovieCommentEntity;
import com.movie.modules.jf.service.MovieCommentService;
import org.springframework.transaction.annotation.Transactional;


@Service("movieCommentService")
@Transactional
public class MovieCommentServiceImpl extends ServiceImpl<MovieCommentDao, MovieCommentEntity> implements MovieCommentService {

    @Autowired
    private MovieCommentDao commentDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<MovieCommentEntity> page = this.page(
                new Query<MovieCommentEntity>().getPage(params),
                new QueryWrapper<MovieCommentEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public PageUtils getCommentByMovieId(Map<String, Object> params, Integer movieId) {
        IPage<MovieCommentEntity> page= commentDao.getCommentByMovieId(new Query<MovieCommentEntity>().getPage(params),movieId);
        return new PageUtils(page);
    }

    @Override
    public PageUtils getCommentByVipId(Map<String, Object> params, Integer vipId) {
    return new PageUtils(commentDao.getCommentByVipId(new Query<MovieCommentEntity>().getPage(params),vipId));
    }

}